﻿<?xml version="1.0" encoding="utf-8"?>
<FieldTypes>

    <!-- Picture Column-->
    <FieldType>
        <Field Name="TypeName">Sparqube.PictureLiteField</Field>
        <Field Name="TypeDisplayName">$Resources:Sparqube.PictureLiteField.Global,fldtype_PictureLite;</Field>
        <Field Name="TypeShortDescription">$Resources:Sparqube.PictureLiteField.Global,fldtype_PictureLite_desc;</Field>
        <Field Name="ParentType">Note</Field>
        <Field Name="UserCreatable">TRUE</Field>
        <Field Name="FieldTypeClass">Sparqube.SharePoint.PictureColumnLite.PictureLiteField, $SharePoint.Project.AssemblyFullName$</Field>
        <Field Name="Sortable">FALSE</Field>
        <Field Name="Filterable">FALSE</Field>
        <Field Name="InternalType">Sparqube.PictureLiteField</Field>
        <Field Name="SQLType">ntext</Field>
        <Field Name="CAMLRendering">TRUE</Field>
        <Field Name="FieldEditorUserControl">/_controltemplates/Sparqube.PictureLiteField/PictureLiteFieldEditor.ascx</Field>

        <PropertySchema>
            <Fields>
                <Field Name="StorageFolderUrl" Hidden="TRUE" DisplayName="StorageFolderUrl" Type="Text"/>

                <Field Name="ThumbSize" Hidden="TRUE" DisplayName="ThumbSize" Type="Text"/>
                <Field Name="ThumbWidth" Hidden="TRUE" DisplayName="ThumbWidth" Type="Text"/>
                <Field Name="ThumbHeight" Hidden="TRUE" DisplayName="ThumbHeight" Type="Text"/>
            </Fields>            
        </PropertySchema>
        <RenderPattern Name="DisplayPattern">
            <Switch>
                <Expr>
                    <Column/>
                </Expr>
                <Case Value="">
                    <HTML><![CDATA[&nbsp;]]></HTML>
                </Case>
                <Default>
                    <IfSubString>
                        <Expr1>
                            <HTML><![CDATA[|]]></HTML>
                            <Property Select='Name'/>
                            <HTML><![CDATA[|]]></HTML>
                        </Expr1>
                        <Expr2>
                            <GetVar Name="SQ_PictureLite" Scope="Request"/>
                        </Expr2>
                        <Then>
                        </Then>
                        <Else>
                            <SetVar Name="SQ_PictureLite" Scope="Request">
                                <GetVar Name="SQ_PictureLite" Scope="Request"/>
                                <HTML><![CDATA[|]]></HTML>
                                <Property Select='Name'/>
                                <HTML><![CDATA[|]]></HTML>
                            </SetVar>

                            <HTML><![CDATA[<style type="text/css">.sq-img-]]></HTML>
                            <Property Select="Name"/>
                            <HTML><![CDATA[{]]></HTML>

                            <Switch>
                                <Expr>
                                    <Property Select='ThumbWidth'/>
                                </Expr>
                                <Case Value=""></Case>
                                <Case Value="0"></Case>
                                <Default>
                                    <HTML><![CDATA[width:]]></HTML>
                                    <Property Select='ThumbWidth'/>
                                    <HTML><![CDATA[px;]]></HTML>
                                </Default>
                            </Switch>
                            <Switch>
                                <Expr>
                                    <Property Select='ThumbHeight'/>
                                </Expr>
                                <Case Value=""></Case>
                                <Case Value="0"></Case>
                                <Default>
                                    <HTML><![CDATA[height:]]></HTML>
                                    <Property Select='ThumbHeight'/>
                                    <HTML><![CDATA[px;]]></HTML>
                                </Default>
                            </Switch>
                            
                            <HTML><![CDATA[}</style>]]></HTML>                            
                        </Else>
                    </IfSubString>
                    <Column/>
                </Default>                
            </Switch>
        </RenderPattern>
    </FieldType>

</FieldTypes>